﻿using Spanner;

namespace SpannerWebSite
{
    internal partial class YourNameInLights : UI
    {
        internal static Html Content()
        {
            var name = ObsVar<string>("name", "");
            var bodyHtml = Group(
                P("Please tell me your name: ", Input().KoValue(name)),
                Div().KoVisible(name != "").WithChildren(
                    P("Your name in lights:").WithAttr("style", "margin-bottom: 40px"),
                    Show(ToUpperCase(name))
                        .WithAttr("style", "border: 10px dotted blue")
                        .WithAttr("style", "font-size: 40px")
                        .WithAttr("style", "margin-left: 40px")
                )
            );
            return bodyHtml;
        }
        internal static void WriteWebPage()
        {
            // START
            const string path = Const.DemoWebSitePath;
            var html = StandardSpannerHtmlPage("Your name in lights", Content());
            var initAct = (Act)null;
            var webPage = WebPage("YourNameInLights", html, initAct);
            var ctxt = new Context(path);
            ctxt.WriteWebPage(webPage);
            // END
        }
    }
}
